import { ApiCall } from "tsrpc";
import { ReqAddData, ResAddData } from "../../shared/protocols/pandian/PtlAddData";
import { Global } from "../../models/Global";

// This is a demo code file
// Feel free to delete it

export default async function (call: ApiCall<ReqAddData, ResAddData>) {
    // Error

    let time = new Date();

    const ret = await Global.db.collection('pandian').insertOne({
        SerialNum: call.req.SerialNum,
        Location: call.req.Location,
        AbnormalInfo: call.req.AbnormalInfo,
        User: call.req.User,
        time: new Date()
    });
    return call.succ({ insertedId: ret.insertedId.toString() })



}